package com.summer.springboot.task.async.task.async;

import com.summer.springboot.task.async.task.AbstrackTask;
import lombok.SneakyThrows;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;

@Component
public class AsyncTask extends AbstrackTask {

    @SneakyThrows
    @Async
    public Future<String> doTaskOneWithCallBack() {
        super.doTaskOne();
        return new AsyncResult<>("任务一完成");
    }

    @SneakyThrows
    @Async
    public Future<String> doTaskTwoWithCallBack() {
        super.doTaskTwo();
        return new AsyncResult<>("任务二完成");
    }

    @SneakyThrows
    @Async
    public Future<String> doTaskThreeWithCallBack() {
        super.doTaskThree();
        return new AsyncResult<>("任务三完成");
    }

}
